package a2023.a0330;

import java.util.*;
import java.util.concurrent.atomic.AtomicReference;

/**
 * @author lenovo
 * @date 2023/3/30
 */
public class a {
    public static void main(String[] args) {
        System.out.println(maxWidthOfVerticalArea(new int[][]{{8, 7}, {9, 9}, {7, 4}, {9, 7}}));
    }

    public static int maxWidthOfVerticalArea(int[][] points) {
        int len = points.length;
        int num = 0;
//        List<int[]> list = Arrays.asList(points);
//        Collections.sort(list, (l1, l2) -> l1[0] - l2[0]);
        Arrays.sort(points, (a, b) -> a[0] - b[0]);
        for (int i = 0; i < len - 1; i++) {
//            num = Math.max(num, list.get(i + 1)[0] - list.get(i)[0]);
            num = Math.max(num, points[i + 1][0] - points[i][0]);
        }
        return num;
    }
}


